package com.example.hyg_veintype.utils;

import android.content.Context;


import com.example.hyg_veintype.R;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * author: yyw
 * time: 2020/11/26 10:40
 * desc: raw文件下脉型数据读取
 */
public class ReadPluseTypeUtil {

    public static String getPluseType(Context context) {
        StringBuffer stringBuffer = new StringBuffer("");
        InputStreamReader inputReader = null;
        BufferedReader bufReader = null;
        try {
            inputReader = new InputStreamReader(context.getResources().openRawResource(R.raw.plusetype), "UTF-8");
            bufReader = new BufferedReader(inputReader);
            String line = "";
            while ((line = bufReader.readLine()) != null) {
                stringBuffer.append(line);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufReader != null) {
                    bufReader.close();
                }
                if (inputReader != null) {
                    inputReader.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return stringBuffer.toString();

    }
}
